<template>
  <div class="boxsed">
    <div v-if="searchs == 'list'" class="fli_list">
      <div class="sma_box">
        <el-form :inline="true" :model="formInline" class="demo-form-inline">
          <el-form-item>
            <el-select clearable v-model="value" placeholder="请选择">
              <el-option v-for="item in type" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="">
            <el-input v-model="formInline.region"></el-input>
          </el-form-item>
          <el-form-item label="">
            <el-input v-model="formInline.user"></el-input>
          </el-form-item>
          <el-form-item>
            <el-date-picker v-model="value1" type="daterange" range-separator="至" start-placeholder="开始日期"
              end-placeholder="结束日期">
            </el-date-picker>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="submitForm('ruleForm')">重新搜索</el-button>
            <el-button @click="resetForm('ruleForm')">清空缓存</el-button>
          </el-form-item>
        </el-form>
      </div>
      <div class="sma_box">
        <el-form :inline="true" :model="formInlineed" class="demo-form-inline">
          <el-form-item>
            <el-checkbox-group v-model="checkList">
              <el-checkbox label="复选框 A"></el-checkbox>
              <el-checkbox label="复选框 B"></el-checkbox>
              <el-checkbox label="复选框 C"></el-checkbox>
              <el-checkbox label="禁用" disabled></el-checkbox>
              <el-checkbox label="选中且禁用" disabled></el-checkbox>
            </el-checkbox-group>
          </el-form-item>
          <el-form-item label="">
            <el-input v-model="formInlineed.region"></el-input>
          </el-form-item>
          <el-form-item label="">
            <el-input v-model="formInlineed.user"></el-input>
          </el-form-item>
          <el-form-item>
            <el-date-picker v-model="value2" type="daterange" range-separator="至" start-placeholder="开始日期"
              end-placeholder="结束日期">
            </el-date-picker>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="submitForm('formInlineed')">重新搜索</el-button>
            <el-button @click="resetForm('formInline')">清空缓存</el-button>
          </el-form-item>
        </el-form>
      </div>
      <div class="sma_box"></div>
    </div>
  </div>
</template>

<script>
  // import Flightschedule from '../../views/reserve/flightlist.vue'
  import Format from "../../common/format.js";
  export default {
    name: "",
    components: {
      // Flightschedule,
      Format,
    },

    data() {
      return {
        show: false,
        BreadCrumb: [{
            path: "/flight/flightlist",
            name: "机票列表"
          },
          {
            path: "",
            name: "权限管理"
          },
        ],
        cabinList: ["不限舱位", "经济舱", "公务舱/头等舱"],
        formInline: {
          region: "",
          user: "",
        },
        formInlineed: {
          region: "",
          user: "",
        },
        value1: "",
        value: "",
        value: "",
        // cabinList:[
        //   {
        //     id:0,
        //     names:'不限舱位',
        //     is:true
        //   },
        //   {
        //     id:1,
        //     names:'经济舱',
        //     is:false
        //   },
        //   {
        //     id:2,
        //     names:'公务舱/头等舱',
        //     is:false
        //   }
        // ],
        type1: "0",
        checkList: [],
        // 出发日期
        value1: "",
        value2: "",
        // 出发城市
        cityName: "",
        cityName1: "",
        date1: "",
        date2: "",
        checked: true,
        options: [],
        value: "",
        optionsed: [],
        type: [],
        label: "",
        typeList: [{
            id: "大",
            type: "大机型",
            is: false,
          },
          {
            id: "中",
            type: "中机型",
            is: false,
          },
          {
            id: "小",
            type: "小机型",
            is: false,
          },
        ],
        cityList: [],
        cityList1: [],
        journeyactive: 0,
        children: false,
        // 单程
        oneway: [{
          id: 0,
          cwcity: "北京",
          ddcity: "上海",
          gotime: "",
          ddtime: "",
          goweekday: "今天",
          ddweekday: "今天",
        }, ],

        GoSearchWhere: {},
      };
    },
    mounted() {
      console.log(this.searchs);
      this.getCityList();
    },
    methods: {
      formInline() {},
      // 查询机票
      ticketlist() {
        let oneway = this.oneway;
        oneway[0].cwcity = this.cityName;
        oneway[0].ddcity = this.cityName1;
        oneway[0].gotime = this.date1;
        oneway[0].ddtime = this.date2;
        oneway[0].goweekday = Format.getweekday(this.value1);
        oneway[0].ddweekday = Format.getweekday(this.value2);
        let list = this.cabinList.filter((item) => {
          if (item.is == true) {
            return item.names;
          }
        });
        console.log(list);
        // 单程
        let GoSearchWhere = {
          listinfo: this.oneway[0],
          children: this.children,
          shipping: list,
        };
        console.log(GoSearchWhere);
        // 返程
        // let BackSearchWhere = {
        //   listinfo:this.data.journeyway[0],
        //   children:this.data.chirList[0].is,
        //   infant:this.data.chirList[1].is,
        //   shipping:this.data.array[this.data.shipping]
        // }
        // let timeArr = {
        //   aircrafttime:this.aircrafttime,
        //   endtime:this.data.endtime
        // }
        // console.log(GoSearchWhere)
        this.$emit("buttonEvent", this.searched);
        if (this.journeyactive == 1) {
          // wx.navigateTo({
          //   url: '/aircraft/pages/ticketlist/index?GoSearchWhere='+JSON.stringify(GoSearchWhere)+'&type=1',
          // })
        } else if (this.journeyactive == 2) {
          // wx.navigateTo({
          //   url: '/aircraft/pages/returnalist/index?BackSearchWhere='+JSON.stringify(BackSearchWhere)+'&type=2',
          // })
        }
        // wx.navigateTo({
        //   url: '/aircraft/pages/ticketlist/index?GoSearchWhere='+JSON.stringify(GoSearchWhere)+'&hasKeyCustomers='+this.data.hasKeyCustomers+'&IsNoCache='+this.data.IsNoCache+'&TripType='+this.data.journeyactive+'&singleTime='+this.data.aircrafttime,
        // })
      },
      // 搜索
      search() {
        // this.$router.push({path:'/reserve/flight'})
      },
      // 机票查询
      // 机票查询
      // 选择城市
      getCityList() {
        this.$axios.getCityList().then((res) => {
          console.log(res);
          if (res.code == "200") {
            this.cityList = res.data;
            this.cityList1 = res.data;
          }
        });
      },
    },
  };
</script>

<style scoped>
  .boxsed {
    width: 650px;
    margin: 50px auto;
  }

  .title {}

  .fli_list {}

  .sma_box {
    background: #ffffff;
  }
</style>